/*****************************
 *  博主: 天才小狐狸
 *  公众号: Java设计
 *  邮箱：genius.fox@gmail.com
 *  含泪播种的人一定能含笑收获
 ****************************/

package com.example.distinguish_server.result.codemessage;

/**
 * Author: 花棉袄
 * CreateDate: 2022年08月22日
 * Describe: 返回状态码信息
 */
public enum HTTPCodeMessage {

    /**
     * 2XX
     */
    SUCCESS(200, "操作成功!"),

    /**
     * 3xx
     */
    MOVED_PERM(301, "资源已被移除"),
    SEE_OTHER(303, "重定向"),
    NOT_MODIFIED(304, "资源没有被修改"),

    /**
     * 4XX
     */
    BAD_REQUEST(400, "错误的请求"),
    UNAUTHORIZED(401, "没有权限，要求用户的身份认证"),
    PAYMENT_REQUIRED(402, "Payment Required"),
    FORBIDDEN(403, "访问受限，授权过期"),
    NOT_FOUND(404, "Not Found"),
    METHOD_NOT_ALLOWED(405, "不允许的方法"),
    NOT_ACCEPTABLE(406, "Not Acceptable"),
    PROXY_AUTHENTICATION_REQUIRED(407, "需要代理身份验证"),
    REQUEST_TIMEOUT(408, "Request Timeout"),
    CONFLICT(409, "资源冲突"),
    GONE(410, "资源已经不存在(过去存在)"),
    LENGTH_REQUIRED(411, "Length Required"),
    PRECONDITION_FAILED(412, "前提条件失败"),
    PAYLOAD_TOO_LARGE(413, "有效载荷太大"),
    REQUEST_ENTITY_TOO_LARGE(413, "请求的实体太大"),
    URI_TOO_LONG(414, "URI 太长"),
    REQUEST_URI_TOO_LONG(414, "请求 URI 太长"),
    UNSUPPORTED_MEDIA_TYPE(415, "不支持的媒体类型"),
    REQUESTED_RANGE_NOT_SATISFIABLE(416, "请求的范围不满足"),
    EXPECTATION_FAILED(417, "预期失败"),
    I_AM_A_TEAPOT(418, "I'm a teapot"),
    INSUFFICIENT_SPACE_ON_RESOURCE(419, "资源空间不足"),
    METHOD_FAILURE(420, "方法失败"),
    DESTINATION_LOCKED(421, "Destination Locked"),
    UNPROCESSABLE_ENTITY(422, "无法处理的实体"),
    LOCKED(423, "Locked"),
    FAILED_DEPENDENCY(424, "Failed Dependency"),
    TOO_EARLY(425, "Too Early"),
    UPGRADE_REQUIRED(426, "Upgrade Required"),
    PRECONDITION_REQUIRED(428, "Precondition Required"),
    TOO_MANY_REQUESTS(429, "Too Many Requests"),
    REQUEST_HEADER_FIELDS_TOO_LARGE(431, "Request Header Fields Too Large"),
    UNAVAILABLE_FOR_LEGAL_REASONS(451, "Unavailable For Legal Reasons"),

    /**
     * 5XX
     */
    SYSTEM_EXCEPTION(500, "系统异常!"),
    SYSTEM_RUN_EXCEPTION(501, "未知的运行时异常"),
    CUSTOM_EXCEPTION(502, "自定义异常"),
    SERVICE_UNAVAILABLE(503, "系统繁忙,请稍后重试!"),
    NOT_IMPLEMENTED(504, "接口未实现"),
    AUTHENTICATION_EXCEPTION(505, "身份验证异常"),

    PARAMETER_BINDING_EXCEPTION(506, "请求参数绑定异常"),
    PARAMETER_FORMAT_EXCEPTION(507, "类型不匹配异常"),
    Http_Message_Conversion_Exception(508, "Http消息不可读异常"),
    DATA_ACCESS_EXCEPTION(509, "数据访问异常"),

    SERVICE_EXCEPTION(600, "自定义业务异常"),
    BASE_EXCEPTION(601, "基础异常");

    private final String message;
    private final int code;

    HTTPCodeMessage(int code, String message) {
        this.message = message;
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public int getCode() {
        return code;
    }

}
